|
|
|
|
|
|
|
Figure 21.4.
Running the User Login form. |
|
|
|
|
|
|
|
|
When you see the login form, enter USERA as the User ID and USERA as the password (remember, you added this in the previous example). Next, you see the User Maintenance form. When you exit this form, the routine automatically updates your logout time stamp. |
|
|
|
|
|
|
|
|
You now have a complete and portable user login and logout system for your Visual Basic applications. Now let's add an additional application security featureuser access rights. |
|
|
|
|
|
|
|
|
Developing a User Access Rights System |
|
|
|
|
|
|
|
|
You can add an increased level of application security to your Visual Basic programs by establishing a user access rights scheme. An access rights scheme enables you to define a set of secured operations within your program and then define access rights for each of the operations on a user-by-user basis. For example, you might want to restrict the ability to print certain reports to specifically qualified users. You might also want to limit the number of users who can access data entry forms. You might even want to allow some users to modify data, but not create new records or delete existing records. Any of these arrangements can be handled by defining and implementing a user access rights security scheme. |
|
|
|
|
|
|
|
|
Defining the User Access Rights Scheme |
|
|
|
|
|
|
|
|
Before you can code the new features, you need to consider how the scheme will be implemented in your Visual Basic applications. This exercise uses a typical rights scheme that uses a sliding scalethe lowest level on the scale has no rights at all; the highest level has all possible rights. Table 21.3 shows the proposed set of access rights. |
|
|
|
|
| Table 21.3. The scale of access rights levels. | | Rights Level | Access Rights | | Level 0 | No rights | | Level 1 | Read-only rights | | Level 2 | Read and modify rights | | Level 3 | Read, modify, and add rights | | Level 4 | Read, modify, add, and delete rights | | Level 5 | All, plus extended rights |
|
|
|